package com.example.wpx.controller;

import com.example.wpx.service.EntrustSerivice;
import com.example.wpx.service.UserService;
import com.example.wpx.util.ServerResponse;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("entrust/")
public class EntrustController {
    @Autowired
    private EntrustSerivice entrustSerivice;
    @PostMapping("add")
    public ServerResponse add(String uid,String seviceType, String uname,String phone,String content,String money){
        return entrustSerivice.add(uid, seviceType,  uname, phone, content,money);
    }

    @PostMapping("get")
    public ServerResponse get(String eid,String uid){
        return entrustSerivice.get( eid, uid);
    }
    @PostMapping("all_list")
    public ServerResponse all_list(@RequestParam(value="serviceType",required = false,defaultValue = "0") String serviceType){
        System.out.println(serviceType);
        return entrustSerivice.allList(serviceType);
    }

    //我的发布
    @PostMapping("my_release")
    public ServerResponse my_release(String uid){
        return entrustSerivice.myRelease(uid);
    }
    //我的接单
    @PostMapping("my_get")
    public ServerResponse my_get(String uid){
        return entrustSerivice.myGet(uid);
    }

    //结束订单
    @PostMapping("finish")
    public ServerResponse finish(String eid,String uid){
        return entrustSerivice.finish(eid,uid);
    }
}